﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WebCamTimeLapse
{
    public partial class frmAdd : Form
    {
        public string Description;
        public string URL;
        public string LocalDirectory;
        public string Interval;

        public frmAdd()
        {
            InitializeComponent();
        }

        private void btnTest_Click(object sender, EventArgs e)
        {
            pictureBox1.ImageLocation = txtURL.Text;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtDescription.Text == String.Empty ||
                txtURL.Text == String.Empty ||
                txtSave.Text == String.Empty ||
                txtInterval.Text == String.Empty)
            {
                MessageBox.Show("Value is required for all boxes.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.DialogResult = DialogResult.None;
            }
            else
            {
                this.Description = txtDescription.Text;
                this.URL = txtURL.Text;
                this.LocalDirectory = txtSave.Text;
                this.Interval = txtInterval.Text;
                this.DialogResult = DialogResult.OK;
            }
        }

        private void btnBrowse_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();
            if (fbd.ShowDialog() == DialogResult.OK)
            {
                txtSave.Text = fbd.SelectedPath;
            }
        }
    }
}
